<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <div>TODO write content</div>
        <input type='button' value='Send msg' onclick="sendMsg();" />
    <script>
    // 假设服务端ip为127.0.0.1
    ws = new WebSocket("ws://hx2.hztc.dev.kaitianad.com:2345");
    ws.onopen = function() {
        console.log("连接成功");
        var d = new Date();
        ws.send('JS-Client:'+d.getTime());
        console.log("给服务端发送一个字符串：tom");
    };
    ws.onmessage = function(e) {
        console.log("收到服务端的消息：" + e.data);
    };
    </script>
    </body>
</html>